package com.tchintech.pay.view.activity;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;

import com.google.gson.Gson;
import com.tchintech.pay.R;
import com.tchintech.pay.delegate.OrderActivityDelegate;
import com.tchintech.pay.frame.presenter.ActivityPresenter;
import com.tchintech.pay.model.entity.HttpCode;
import com.tchintech.pay.model.entity.PayTypeModel;
import com.tchintech.pay.model.entity.ResultBean;
import com.tchintech.pay.model.entity.TransactionModeResult;
import com.tchintech.pay.net.HttpRequester;
import com.tchintech.pay.utils.AppConst;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/7/6 0006.
 */

public class OrderActivity extends ActivityPresenter<OrderActivityDelegate> implements View.OnClickListener {

    private Map<String, String> map;
    private final String URL_order_create = "Order/create";
    private final String URL_TransactionMode_query = "TransactionMode/query";
    private Handler handler;
    private PayTypeModel payTypeModel;//TODO  支付方式   到账方式
    private List<PayTypeModel> list;
    private Spinner spinner;

    @Override
    protected Class<OrderActivityDelegate> getDelegateClass() {
        return OrderActivityDelegate.class;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void initView() {
        super.initView();
        spinner = (Spinner) viewDelegate.getView(R.id.order_sp_payType);
        viewDelegate.getTextView(R.id.order_tv_phonenumber).setText(AppConst.getUser().getPhone());
        viewDelegate.setOnClickListener(this, R.id.order_bt_create, R.id.order_bt_query);
        String mesg = "";

        viewDelegate.getTextView(R.id.order_tv_userstate).setText(mesg);

        handler = new Handler() {
            @Override
            public void handleMessage(Message msg) {
                super.handleMessage(msg);
                switch (msg.what) {

                }

            }
        };
    }

    private void noPermission() {
        viewDelegate.getTextView(R.id.order_tv_tips).setText("不可交易");
        ((Button) viewDelegate.getView(R.id.order_bt_create)).setClickable(false);
        ((Spinner) viewDelegate.getView(R.id.order_sp_payType)).setClickable(false);
    }


    @Override
    protected void initData() {
        super.initData();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.order_bt_create:

                break;
            case R.id.order_bt_query:
                showMsg("查询暂不可用");
                break;
        }
    }

  /*
    private void httpPost(String url, Map<String, String> map, int what) {
        String path = HttpRequester.path(url, map);
        try {
            showProgressDialog("", "加载中，请稍后...");
            HttpRequester.post(this, what, path, map, this, null);
        } catch (Exception e) {
            hideProgressDialog();
            showMsg("网络异常");
        }
    }
*/
    @Override
    public void httpCallback(String resultBean, int what) {
        super.httpCallback(resultBean, what);
        Message msg = new Message();
        switch (what) {


        }

    }
}
